import fetch from '../fetch';

export async function getAllArticles(params) {
  const opt = {
    url: '/getAllArticles',
    params,
  };
  return fetch(opt);
}

export async function getRecommended(params) {
  const opt = {
    url: '/getRecommend',
    params,
  };
  return fetch(opt);
}

export async function initialEditor(params) {
  const opt = {
    url: '/initialEditor',
    params,
  };
  return fetch(opt);
}

export async function getDraft(params) {
  const opt = {
    url: '/getDraft',
    params,
  };
  return fetch(opt);
}

export async function updateArticleById(data) {
  const opt = {
    url: '/updateArticleById',
    data,
    method: 'post',
  };
  return fetch(opt);
}
